<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加系统参数</title>
    <script src="../../static/js/jquery-3.3.1.min.js"></script>
    <script src="../../static/js/vue.js"></script>
    <script src="../../static/js/utils.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>
        #app{
            /*margin-left: 30px;*/
            /*text-align: center;*/
            display: flex;
            justify-content:center;
        }
    </style>
</head>
    <body>
        <div id="app">
            <el-form :model="addForm" ref="ruleForm" label-width="80px" style="width: 50%">
                <el-form-item label="编号">
                    <el-input v-model="addForm.id" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="参数类型">
                    <el-input v-model="addForm.paramtype"></el-input>
                </el-form-item>
                <el-form-item label="参数值">
                    <el-input v-model="addForm.paramvalue"></el-input>
                </el-form-item>
                <el-form-item label="显示值">
                    <el-input v-model="addForm.disvalue"></el-input>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input v-model="addForm.remark"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="submitForm">提交</el-button>
                    <el-button @click="resetForm('ruleForm')">重置</el-button>
                </el-form-item>
            </el-form>

        </div>

        <script>
            let vm = new Vue({
                el: "#app",
                data: {
                    addForm:{
                        id:"",
                        paramtype:"",
                        paramvalue:"",
                        disvalue:"",
                        remark:""
                    }
                },
                methods: {
                    submitForm() {
                        addOrUpdateAjax("post","/parametertable/add",vm.addForm,function(data){
                            console.log(vm.addForm);

                            console.log(vm.addForm);
                            vm.addForm = {
                                id:"",
                                paramtype:"",
                                paramvalue:"",
                                disvalue:"",
                                remark:""
                            }
                        });
                    },
                    resetForm(formName) {
                        this.$refs[formName].resetFields();
                    }
                }
            });
        </script>
</body>
</html>